int collision_bsp(bsp_node *n,vector& p1,vector& p2,int elemtype=0,float rad=0.0f)
Parameter | Type | Description |
---|---|---|
n | bsp_node * | bsp root node |
p1 | vector& | first point |
p2 | vector& | secont point |
elemtype | int | object type modifier |
rad | float | collision radius |
Returns TRUE if a collision is found, FALSE if no collision is found.
This function is used for collision detection between p1 and p2. It finds the closest collision from p1 to p2 and return the collision information in the following flyEngine members:
bsp_object *hitobj; // object pointer
mesh *hitmesh; // mesh pointer
int hitface; //
face index into mesh
vector hitip; //
intersected point in face
A faster version of this function is the collision_test function that returns the first collision from p1 to p2.